<!--获取发票动画-->
<template>
  <div v-if="show">
    <div class="fadeIn" @click="closeLoad"></div>
    <div class="caseBlanche">
      <div :class="rondClass">
        <div class="circle">
          <div class="big-circle"></div>
          <div class="small-circle"></div>
        </div>
      </div>
      <div class="load">
        <p>{{title}}</p>
      </div>
      <div v-if="error" class="load-text error">{{text}}</div>
      <div v-else class="load-text">{{text}}</div>
    </div>
  </div>
</template>

<script>
  export default {
    name: "load",
    data(){
      return {
        show: false,
        rondClass: 'rond',
        title: '获取中...',
        text: '获取邮箱信息中',
        error: false,
      }
    },
    methods: {
      showLoad(tx){ //开始旋转动画
        this.rondClass = 'rond'
        this.title = '获取中...'
        this.error = false
        this.show = true
        this.text = tx
      },
      loadSucc(tx){ //结束旋转动画
        this.text = tx
        this.error = false
        this.title = '获取完成'
        this.rondClass = 'rond-end'
      },
      closeLoad(){
        this.show = false
      },
      setLoadText(tx){
        this.text = tx
        this.error = false
      },
      setErrorText(tx){
        this.title = '获取失败'
        this.rondClass = 'rond-end'
        this.error = true
        this.text = tx
      },
    },
  }
</script>

<style scoped>

  .caseBlanche {
    height : 102px;
    width : 102px;
    position: absolute;
    top: 45%;
    left: 45%;
    z-index: 99;
  }
  .fadeIn{
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.1);
    position: absolute;
    top: 0;
    left: 0;
    z-index: 99;
  }
  .load {
    color : #fff;
    text-align : center;
    position : absolute;
    top : 30px;
    left :26px;
  }
  .caseBlanche .load-text{
    position: absolute;
    top: 110px;
    color: #007cf5;
    width: 102px;
    text-align: center;
  }
  .load-text.error{
    color: red;
  }
  /****DEBUT TEST****/
  .circle {
    position: relative;
    width: 13px;
    height: 13px;
    top: 18px;
  }
  /*旋转圆点*/
  .small-circle {
    border-radius: 50%;
    width: 12px;
    height: 12px;
    background: #007cf5;
    position: absolute;
  }
  /*旋转圆点的光圈*/
  .big-circle {
    position: absolute;
    top: -1px;
    left: -1px;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #1201ef;
    animation: twinkling 1s infinite ease-in-out;
    animation-fill-mode: both;
  }
  @keyframes twinkling {
    0% {
      opacity: 0.2;
      transform: scale(1);
    }

    50% {
      opacity: 0.5;
      transform: scale(1.12);
    }

    100% {
      opacity: 0.2;
      transform: scale(1);
    }
  }
  .rond {
    height  : 100px;
    width : 100px;
    border : 2px solid #2c91ff;
    border-radius : 50%;
    background: rgb(129, 176, 227);
    position :absolute;
    top : 0px;
    left : 0px;
    animation : rond 2s infinite;
    -webkit-animation : rond 2s infinite;
  }
  .rond-end {
    height  : 100px;
    width : 100px;
    border : 2px solid #2c91ff;
    border-radius : 50%;
    background: rgb(129, 176, 227);
    position :absolute;
    top : 0px;
    left : 0px;
  }

  @keyframes rond {
    0% {transform : rotate(0deg);}
    100% {transform : rotate(360deg);}
  }

  @-webkit-keyframes rond {
    0% {-webkit-transform : rotate(0deg);}
    100% {-webkit-transform : rotate(360deg);}
  }
  /****FIN TEST****/


</style>
